#pragma once

#include "CReferenceCount.h"
#include "HWInstanceInfo.h"
#include "HWBatchState.h"

class HWInstance :
	public CReferenceCount
{

private: 
	HWInstance(const struct HWBatchState &, const struct HWInstanceInfo &);
	virtual ~HWInstance();
public: 
	static HRESULT Create(const struct HWBatchState & batchState, const struct HWInstanceInfo & renderData, HWInstance * * ppInstance);
	void InsertAfter(HWInstance * pPrev);
	void Remove();
	HWInstance * GetNext();
	const struct HWBatchState & GetRenderState();
	const struct HWInstanceInfo & GetRenderData();
	void DrawAfter(HWInstance * pPrev);
	void ClearDrawOrder();
	HWInstance * GetDrawNext();
	void SetNearestCompNode(HWCompTreeNode * pNode);
	static XBOOL IsSameSolidColor(const HWInstance * pLeft, const HWInstance * pRight);
private: 
	struct HWBatchState m_renderState;
	struct HWInstanceInfo m_renderData;
	HWInstance * m_pPrev;
	HWInstance * m_pNext;
	HWInstance * m_pDrawNextNoRef;
};